#include<bits/stdc++.h>
using namespace std;
long long a[100010],b[100010],c[100010];
int main(){
	freopen("summer.in","r",stdin);
	freopen("summer.out","w",stdout);
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i]>>b[i]>>c[i];
		a[i]+=max(b[i-1],c[i-1]);
		b[i]+=max(a[i-1],c[i-1]);
		c[i]+=max(b[i-1],a[i-1]);
	} 
	cout<<max(a[n],max(b[n],c[n]));
	return 0;
}
